const router = require('@koa/router')()
const jwt = require('../utils/jwt')
const { findDetail } = require('../controllers/index')

router.get('/detail',jwt.verify(),async (ctx)=>{
    const { id } = ctx.request.query
    try {
        const res = await findDetail(id)
        if(res.length){
            ctx.body = {
                code: '800',
                data:res,
                msg:'查询成功'
            }
        }else{
            ctx.body = {
                code: '801',
                msg:'查询失败'
            }
        }
    } catch (error) {
        ctx.body = {
            code: '802',
            msg:'服务器异常',
            data: error
        }
    }
})

module.exports = router